package br.com.consultsystems.interfaces;

import java.math.BigDecimal;

import br.com.consultsystems.interfaces.wrapper.BigDecimalTypeAdapter;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public abstract class AbstractService {
	
	private Gson gson;
	
	protected Gson getGSon() {
		
		if(gson == null) {
			GsonBuilder gb = new GsonBuilder();
			gb.disableHtmlEscaping();
			gb.registerTypeAdapter(BigDecimal.class, new BigDecimalTypeAdapter());
			//gb.registerTypeAdapter(Date.class, new DateTypeAdapter());
			gson = gb.setDateFormat("dd/MM/yyyy").create();
		}
		
		return gson;
		
	}
}
